<template>
  <div class="home">
    <div class="header">
      <header>
        <ul>
          <li 
            v-for="(item,index) in types"
            :key="index"
            @click="type(item)"
          >{{item}}</li>
        </ul>
        <div class="search">
          <i @click="search()" class="iconfont icon-sousuo"></i>
        </div>
      </header>
    </div>
    <newsList :type='curType'></newsList>
    <foot></foot>
  </div>
</template>

<script>

import newsList from '../components/newsList'
import foot from '../components/foot'

export default {
  name: 'home',
  data() {
    return {
      curType:''||'财经',
      types:['体育','财经','科技','旅游','军事']
    }
  },
  components: {
    foot,
    newsList
  },
  methods: {
    search(){
      this.$router.push({name:'search'})
    },
    //切换type
    type(item){
      this.curType = item
    }
  },
  computed: {
  },
}
</script>
<style scoped>
  .header{
    width: 100%;
    background: crimson;
  }
  header{
    display: flex;
    justify-content: space-between;
    width: 90%;
    height: 40px;
    margin: 0 auto;
  }
  header ul{
    display: flex;
  }
  header ul li{
    height: 40px;
    line-height: 40px;
    padding: 0 5px;
    color: white;
    font-weight: bold;
    letter-spacing: 1px;

    font-size: 19px;
  }
  .search i{
    font-size: 24px;
    line-height: 40px;
    color: white;
  }
</style>
